bitkeeper revision 1.550 (3fa62d1fweoECOoyEeNP4Duqo5Btxw)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Mon, 3 Nov 2003 10:25:35 +0000 (10:25 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Mon, 3 Nov 2003 10:25:35 +0000 (10:25 +0000)
Many files:
  More cleanups and renaming for suspend/resume.

13 files changed:
tools/internal/xi_build.c
tools/internal/xi_create.c
tools/internal/xi_destroy.c
tools/internal/xi_list.c
tools/internal/xi_usage.c
tools/misc/xen_log.c
xen/arch/i386/smpboot.c
xen/common/dom0_ops.c
xen/common/domain.c
xen/common/kernel.c
xen/include/asm-i386/processor.h
xen/include/hypervisor-ifs/dom0_ops.h
xen/include/xeno/sched.h

index 81f8a940972036089b14bc4c8e4fad65f476dcb9..f18f9941246778a7149fb6c43731a69610bd9321 100644 (file)
@@ -15,8 +15,8 @@ static long get_tot_pages(int domain_id)
 {
     dom0_op_t op;
     op.cmd = DOM0_GETDOMAININFO;
-    op.u.getdominfo.domain = domain_id;
-    return (do_dom0_op(&op) < 0) ? -1 : op.u.getdominfo.tot_pages;
+    op.u.getdomaininfo.domain = domain_id;
+    return (do_dom0_op(&op) < 0) ? -1 : op.u.getdomaininfo.tot_pages;
 }
 
 static int get_pfn_list(
index b5e718caa969e7948874c4d64ea8b28ccf29ec2e..bd1b31e7af8b97ba46981deb4ba2d8702d5a4608 100644 (file)
@@ -15,13 +15,13 @@ static int create_new_domain(long req_mem, char *name)
     dom0_op_t op;
 
     op.cmd = DOM0_CREATEDOMAIN;
-    op.u.newdomain.memory_kb = req_mem;
-    strncpy(op.u.newdomain.name, name, MAX_DOMAIN_NAME);
-    op.u.newdomain.name[MAX_DOMAIN_NAME-1] = '\0';
+    op.u.createdomain.memory_kb = req_mem;
+    strncpy(op.u.createdomain.name, name, MAX_DOMAIN_NAME);
+    op.u.createdomain.name[MAX_DOMAIN_NAME-1] = '\0';
 
     err = do_dom0_op(&op);
 
-    return (err < 0) ? err : op.u.newdomain.domain;
+    return (err < 0) ? err : op.u.createdomain.domain;
 }    
 
 int main(int argc, char **argv)
index bd91c7941a08f126fdb3914e781867b335c5eb0d..16624b483c9c2c51427ba926156a2e799bbfc58f 100644 (file)
@@ -10,8 +10,8 @@ static int kill_domain(int dom_id, int force)
     dom0_op_t op;
 
     op.cmd = DOM0_DESTROYDOMAIN;
-    op.u.killdomain.domain = dom_id;
-    op.u.killdomain.force  = force;
+    op.u.destroydomain.domain = dom_id;
+    op.u.destroydomain.force  = force;
 
     err = do_dom0_op(&op);
 
index fc8f4ed73c61c24c4bfda856931612da551b8436..73df092b1d0ba7fa3168163680f0297052a34d69 100644 (file)
@@ -55,20 +55,20 @@ int main(int argc, char **argv)
     }
 
     op.cmd = DOM0_GETDOMAININFO;
-    op.u.getdominfo.domain = 0;
+    op.u.getdomaininfo.domain = 0;
     while ( do_dom0_op(&op) >= 0 )
     {
         printf("%8d %2d %1d %2d %s %08x %8ld %8d %s\n",
-               op.u.getdominfo.domain, 
-               op.u.getdominfo.processor,
-               op.u.getdominfo.has_cpu,
-               op.u.getdominfo.state,
-               statestr(op.u.getdominfo.state),
-               op.u.getdominfo.hyp_events,
-               op.u.getdominfo.mcu_advance,
-               op.u.getdominfo.tot_pages,
-               op.u.getdominfo.name);
-        op.u.getdominfo.domain++;
+               op.u.getdomaininfo.domain, 
+               op.u.getdomaininfo.processor,
+               op.u.getdomaininfo.has_cpu,
+               op.u.getdomaininfo.state,
+               statestr(op.u.getdomaininfo.state),
+               op.u.getdomaininfo.hyp_events,
+               op.u.getdomaininfo.mcu_advance,
+               op.u.getdomaininfo.tot_pages,
+               op.u.getdomaininfo.name);
+        op.u.getdomaininfo.domain++;
     }
 
     return 0;
index 59d4f7648a5432754fd5d9bf49b79ef77d1622b6..875a3eae9dfa0f58d0a16cd8b1105a43c63cfccd 100644 (file)
@@ -22,13 +22,13 @@ int main(int argc, char **argv)
     domain = atol(argv[1]);
 
     op.cmd                 = DOM0_GETDOMAININFO;
-    op.u.getdominfo.domain = domain;
+    op.u.getdomaininfo.domain = domain;
     if ( do_dom0_op(&op) < 0 )
         return 1;
 
     printf("cpu%d: %lld\n", 
-           op.u.getdominfo.processor,
-           op.u.getdominfo.cpu_time);
+           op.u.getdomaininfo.processor,
+           op.u.getdomaininfo.cpu_time);
 
     if ( mlock(vifs, sizeof(vifs)) != 0 )
     {
index 012b934030c4171702dea7e393366f0085f71c55..39ed848722229764d8df2e7874768d7706825a2f 100644 (file)
@@ -85,14 +85,14 @@ void process(void)
         curport = ntohs(from.sin_port);
         if ( lastport != curport )
         {
-            op.u.getdominfo.domain = (int)curport;
+            op.u.getdomaininfo.domain = (int)curport;
             if ( do_dom0_op(&op) < 0 )
                 log("Error resolving domain name\n");
             else
                 lastport = curport;
         }
 
-        sprintf(obuf, "[%s] %s", op.u.getdominfo.name, buf);
+        sprintf(obuf, "[%s] %s", op.u.getdomaininfo.name, buf);
         log(obuf);
 
         fromlen = sizeof(from);
index 4f3800903eedda8e93c488409ab3f6cb8c8e202f..506ec09cb92c6766cc87ecb583e647c6b4d35b42 100644 (file)
@@ -669,8 +669,8 @@ static void __init do_boot_cpu (int apicid)
 
     cpu = ++cpucount;
 
-    if ( (idle = do_newdomain(IDLE_DOMAIN_ID, cpu)) == NULL )
-        panic("failed 'newdomain' for CPU %d", cpu);
+    if ( (idle = do_createdomain(IDLE_DOMAIN_ID, cpu)) == NULL )
+        panic("failed 'createdomain' for CPU %d", cpu);
  
     idle->mm.pagetable = mk_pagetable(__pa(idle_pg_table));
 
index b74c2d985dab5666d6b368869abdd8f6399fbcdd..5358f19b502269874e9a35e06aa7a8961d9d19bc 100644 (file)
@@ -144,17 +144,17 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
             goto exit_create;
 
         pro = (pro+1) % smp_num_cpus;
-        p = do_newdomain(dom, pro);
+        p = do_createdomain(dom, pro);
         if ( p == NULL ) 
             goto exit_create;
 
-       if ( op.u.newdomain.name[0] )
+       if ( op.u.createdomain.name[0] )
         {
-            strncpy (p->name, op.u.newdomain.name, MAX_DOMAIN_NAME);
+            strncpy (p->name, op.u.createdomain.name, MAX_DOMAIN_NAME);
             p->name[MAX_DOMAIN_NAME - 1] = 0;
        }
 
-        ret = alloc_new_dom_mem(p, op.u.newdomain.memory_kb);
+        ret = alloc_new_dom_mem(p, op.u.createdomain.memory_kb);
         if ( ret != 0 ) 
         {
             __kill_domain(p);
@@ -165,7 +165,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
         
         ret = p->domain;
         
-        op.u.newdomain.domain = ret;
+        op.u.createdomain.domain = ret;
         copy_to_user(u_dom0_op, &op, sizeof(op));
  
     exit_create:
@@ -175,8 +175,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
 
     case DOM0_DESTROYDOMAIN:
     {
-        unsigned int dom = op.u.killdomain.domain;
-        int force = op.u.killdomain.force;
+        unsigned int dom = op.u.destroydomain.domain;
+        int force = op.u.destroydomain.force;
         ret = (dom == IDLE_DOMAIN_ID) ? -EPERM : kill_other_domain(dom, force);
     }
     break;
@@ -250,7 +250,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
         read_lock_irqsave (&tasklist_lock, flags);
 
         while ( (p = p->next_task) != &idle0_task )
-            if ( !is_idle_task(p) && (p->domain >= op.u.getdominfo.domain) )
+            if ( !is_idle_task(p) && (p->domain >= op.u.getdomaininfo.domain) )
                 break;
 
         if ( p == &idle0_task )
@@ -259,16 +259,16 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
         }
         else
         {
-            op.u.getdominfo.domain      = p->domain;
-            strcpy (op.u.getdominfo.name, p->name);
-            op.u.getdominfo.processor   = p->processor;
-            op.u.getdominfo.has_cpu     = p->has_cpu;
-            op.u.getdominfo.state       = p->state;
-            op.u.getdominfo.hyp_events  = p->hyp_events;
-            op.u.getdominfo.mcu_advance = p->mcu_advance;
-            op.u.getdominfo.tot_pages   = p->tot_pages;
-            op.u.getdominfo.cpu_time    = p->cpu_time;
-            memcpy(&op.u.getdominfo.ctxt, 
+            op.u.getdomaininfo.domain      = p->domain;
+            strcpy (op.u.getdomaininfo.name, p->name);
+            op.u.getdomaininfo.processor   = p->processor;
+            op.u.getdomaininfo.has_cpu     = p->has_cpu;
+            op.u.getdomaininfo.state       = p->state;
+            op.u.getdomaininfo.hyp_events  = p->hyp_events;
+            op.u.getdomaininfo.mcu_advance = p->mcu_advance;
+            op.u.getdomaininfo.tot_pages   = p->tot_pages;
+            op.u.getdomaininfo.cpu_time    = p->cpu_time;
+            memcpy(&op.u.getdomaininfo.ctxt, 
                    &p->shared_info->execution_context,
                    sizeof(execution_context_t));
         }
index 8fa6b8c1f84c1bbb0fd928e06e513c5430b392aa..5005cc9f47762f495785317a25547b53851ef06c 100644 (file)
@@ -33,7 +33,7 @@ struct task_struct *task_hash[TASK_HASH_SIZE];
 /*
  * create a new domain
  */
-struct task_struct *do_newdomain(unsigned int dom_id, unsigned int cpu)
+struct task_struct *do_createdomain(unsigned int dom_id, unsigned int cpu)
 {
     int retval, i;
     struct task_struct *p = NULL;
@@ -441,7 +441,7 @@ static unsigned long alloc_page_from_domain(unsigned long * cur_addr,
 /* setup_guestos is used for building dom0 solely. other domains are built in
  * userspace dom0 and final setup is being done by final_setup_guestos.
  */
-int setup_guestos(struct task_struct *p, dom0_newdomain_t *params, 
+int setup_guestos(struct task_struct *p, dom0_createdomain_t *params, 
                   unsigned int num_vifs,
                   char *phy_data_start, unsigned long data_len, 
                  char *cmdline, unsigned long initrd_len)
index 299215eb7dd46815dded9a2e633e3f5c601e5ea2..6db936a3d7b1ecd2892d4f089e606a73ad7ef825 100644 (file)
@@ -92,7 +92,7 @@ static struct {
 void cmain (unsigned long magic, multiboot_info_t *mbi)
 {
     struct task_struct *new_dom;
-    dom0_newdomain_t dom0_params;
+    dom0_createdomain_t dom0_params;
     unsigned long max_page;
     unsigned char *cmdline;
     module_t *mod;
@@ -190,7 +190,7 @@ void cmain (unsigned long magic, multiboot_info_t *mbi)
 
     init_page_allocator(__pa(&_end), MAX_MONITOR_ADDRESS);
  
-    /* These things will get done by do_newdomain() for all other tasks. */
+    /* These things will get done by do_createdomain() for all other tasks. */
     current->shared_info = (void *)get_free_page(GFP_KERNEL);
     memset(current->shared_info, 0, sizeof(shared_info_t));
     set_fs(USER_DS);
@@ -209,7 +209,7 @@ void cmain (unsigned long magic, multiboot_info_t *mbi)
 
     /* Create initial domain 0. */
     dom0_params.memory_kb = opt_dom0_mem;
-    new_dom = do_newdomain(0, 0);
+    new_dom = do_createdomain(0, 0);
     if ( new_dom == NULL ) panic("Error creating domain 0\n");
 
     /*
index 123edf6739e526d6fef52b1e2897b8c94fe935cd..3f3c8c4ba1025cb06a2fd1b1632e5ac19bf62ed2 100644 (file)
@@ -294,7 +294,6 @@ struct i387_fsave_struct {
     long       foo;
     long       fos;
     long       st_space[20];   /* 8*10 bytes for each FP-reg = 80 bytes */
-    long       status;         /* software status information */
 };
 
 struct i387_fxsave_struct {
@@ -313,24 +312,9 @@ struct i387_fxsave_struct {
     long       padding[56];
 } __attribute__ ((aligned (16)));
 
-struct i387_soft_struct {
-    long       cwd;
-    long       swd;
-    long       twd;
-    long       fip;
-    long       fcs;
-    long       foo;
-    long       fos;
-    long       st_space[20];   /* 8*10 bytes for each FP-reg = 80 bytes */
-    unsigned char      ftop, changed, lookahead, no_update, rm, alimit;
-    struct info        *info;
-    unsigned long      entry_eip;
-};
-
 union i387_union {
     struct i387_fsave_struct   fsave;
     struct i387_fxsave_struct  fxsave;
-    struct i387_soft_struct soft;
 };
 
 typedef struct {
@@ -421,9 +405,32 @@ extern struct desc_struct *idt_tables[];
        {~0, } /* ioperm */                                     \
 }
 
-/* Forward declaration, a strange C thing */
+struct mm_struct {
+    /*
+     * Every domain has a L1 pagetable of its own. Per-domain mappings
+     * are put in this table (eg. the current GDT is mapped here).
+     */
+    l1_pgentry_t *perdomain_pt;
+    pagetable_t  pagetable;
+    /* Current LDT details. */
+    unsigned long ldt_base, ldt_ents, shadow_ldt_mapcnt;
+    /* Next entry is passed to LGDT on domain switch. */
+    char gdt[6];
+};
+
+#define IDLE0_MM                                                    \
+{                                                                   \
+    perdomain_pt: 0,                                                \
+    pagetable:   mk_pagetable(__pa(idle_pg_table))                  \
+}
+
+/* Convenient accessor for mm.gdt. */
+#define SET_GDT_ENTRIES(_p, _e) ((*(u16 *)((_p)->mm.gdt + 0)) = (_e))
+#define SET_GDT_ADDRESS(_p, _a) ((*(u32 *)((_p)->mm.gdt + 2)) = (_a))
+#define GET_GDT_ENTRIES(_p)     ((*(u16 *)((_p)->mm.gdt + 0)))
+#define GET_GDT_ADDRESS(_p)     ((*(u32 *)((_p)->mm.gdt + 2)))
+
 struct task_struct;
-struct mm_struct;
 
 /* Free all resources held by a thread. */
 extern void release_thread(struct task_struct *);
index 6f1cd137b06da85a67b60f53ebe77f9cfd6a03ba..639860dd8bd42b47cc4bf8322a45a52ef35812b8 100644 (file)
 #include "hypervisor-if.h"
 
 
+/*
+ * The following is all CPU context. Note that the i387_ctxt block is filled 
+ * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
+ */
+typedef struct full_execution_context_st
+{
+    execution_context_t i386_ctxt;          /* User-level CPU registers     */
+    char          i387_ctxt[256];           /* User-level FPU registers     */
+    trap_info_t   trap_ctxt[256];           /* Virtual IDT                  */
+    unsigned int  fast_trap_idx;            /* "Fast trap" vector offset    */
+    unsigned long ldt_base, ldt_ents;       /* LDT (linear address, # ents) */
+    unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
+    unsigned long ring1_ss, ring1_esp;      /* Virtual TSS (only SS1/ESP1)  */
+    unsigned long pt_base;                  /* CR3 (pagetable base)         */
+    unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
+} full_execution_context_t;
+
 #define MAX_CMD_LEN       256
 #define MAX_DOMAIN_NAME    16
 
 #define DOM0_CREATEDOMAIN      8
-typedef struct dom0_newdomain_st 
+typedef struct dom0_createdomain_st 
 {
     /* IN parameters. */
     unsigned int memory_kb; 
     char name[MAX_DOMAIN_NAME];
     /* OUT parameters. */
     unsigned int domain; 
-} dom0_newdomain_t;
+} dom0_createdomain_t;
 
 #define DOM0_STARTDOMAIN      10
 typedef struct dom0_startdomain_st
@@ -41,12 +58,12 @@ typedef struct dom0_stopdomain_st
 } dom0_stopdomain_t;
 
 #define DOM0_DESTROYDOMAIN     9
-typedef struct dom0_killdomain_st
+typedef struct dom0_destroydomain_st
 {
     /* IN variables. */
     unsigned int domain;
     int          force;
-} dom0_killdomain_t;
+} dom0_destroydomain_t;
 
 #define DOM0_GETMEMLIST        2
 typedef struct dom0_getmemlist_st
@@ -71,7 +88,7 @@ typedef struct dom0_builddomain_st
     char cmd_line[MAX_CMD_LEN];
     unsigned long virt_mod_addr;
     unsigned long virt_mod_len;
-    execution_context_t ctxt;
+    full_execution_context_t ctxt;
 } dom0_builddomain_t;
 
 #define DOM0_BVTCTL            6
@@ -93,7 +110,7 @@ typedef struct dom0_adjustdom_st
 } dom0_adjustdom_t;
 
 #define DOM0_GETDOMAININFO    12
-typedef struct dom0_getdominfo_st
+typedef struct dom0_getdomaininfo_st
 {
     /* IN variables. */
     unsigned int domain;
@@ -106,8 +123,8 @@ typedef struct dom0_getdominfo_st
     unsigned long mcu_advance;
     unsigned int tot_pages;
     long long cpu_time;
-    execution_context_t ctxt;
-} dom0_getdominfo_t;
+    full_execution_context_t ctxt;
+} dom0_getdomaininfo_t;
 
 #define DOM0_GETPAGEFRAMEINFO 18
 typedef struct dom0_getpageframeinfo_st
@@ -163,22 +180,21 @@ typedef struct dom0_op_st
     unsigned long cmd;
     union
     {
-        dom0_newdomain_t newdomain;
-        dom0_startdomain_t startdomain;
-        dom0_stopdomain_t stopdomain;
-        dom0_killdomain_t killdomain;
-        dom0_getmemlist_t getmemlist;
-        dom0_bvtctl_t bvtctl;
-        dom0_adjustdom_t adjustdom;
-        dom0_builddomain_t builddomain;
-        dom0_getdominfo_t getdominfo;
+        dom0_createdomain_t     createdomain;
+        dom0_startdomain_t      startdomain;
+        dom0_stopdomain_t       stopdomain;
+        dom0_destroydomain_t    destroydomain;
+        dom0_getmemlist_t       getmemlist;
+        dom0_bvtctl_t           bvtctl;
+        dom0_adjustdom_t        adjustdom;
+        dom0_builddomain_t      builddomain;
+        dom0_getdomaininfo_t    getdomaininfo;
         dom0_getpageframeinfo_t getpageframeinfo;
-        dom0_iopl_t iopl;
-       dom0_msr_t msr;
-       dom0_debug_t debug;
-       dom0_settime_t settime;
-    }
-    u;
+        dom0_iopl_t             iopl;
+       dom0_msr_t              msr;
+       dom0_debug_t            debug;
+       dom0_settime_t          settime;
+    } u;
 } dom0_op_t;
 
 #endif
index 40c3e08d6e0213c0e8f452a426d79cea890d1d94..8265726fd83132d8a23b0bcb54b5180a7ca0a844 100644 (file)
@@ -27,31 +27,7 @@ extern struct timeval xtime;
 
 #include <xeno/spinlock.h>
 
-struct mm_struct {
-    /*
-     * Every domain has a L1 pagetable of its own. Per-domain mappings
-     * are put in this table (eg. the current GDT is mapped here).
-     */
-    l1_pgentry_t *perdomain_pt;
-    pagetable_t  pagetable;
-    /* Current LDT details. */
-    unsigned long ldt_base, ldt_ents, shadow_ldt_mapcnt;
-    /* Next entry is passed to LGDT on domain switch. */
-    char gdt[6];
-};
-
-/* Convenient accessor for mm.gdt. */
-#define SET_GDT_ENTRIES(_p, _e) ((*(u16 *)((_p)->mm.gdt + 0)) = (_e))
-#define SET_GDT_ADDRESS(_p, _a) ((*(u32 *)((_p)->mm.gdt + 2)) = (_a))
-#define GET_GDT_ENTRIES(_p)     ((*(u16 *)((_p)->mm.gdt + 0)))
-#define GET_GDT_ADDRESS(_p)     ((*(u32 *)((_p)->mm.gdt + 2)))
-
 extern struct mm_struct init_mm;
-#define IDLE0_MM                                                    \
-{                                                                   \
-    perdomain_pt: 0,                                                \
-    pagetable:   mk_pagetable(__pa(idle_pg_table))                  \
-}
 
 #define _HYP_EVENT_NEED_RESCHED 0
 #define _HYP_EVENT_DIE          1
@@ -218,9 +194,10 @@ extern kmem_cache_t *task_struct_cachep;
 #define get_task_struct(_p)  \
   atomic_inc(&(_p)->refcnt)
 
-extern struct task_struct *do_newdomain(unsigned int dom_id, unsigned int cpu);
+extern struct task_struct *do_createdomain(
+    unsigned int dom_id, unsigned int cpu);
 extern int setup_guestos(
-    struct task_struct *p, dom0_newdomain_t *params, unsigned int num_vifs,
+    struct task_struct *p, dom0_createdomain_t *params, unsigned int num_vifs,
     char *data_start, unsigned long data_len, 
     char *cmdline, unsigned long initrd_len);
 extern int final_setup_guestos(struct task_struct *p, dom0_builddomain_t *);